# -*- coding: utf-8 -*-  
import web
from admin import handlers

urls = (
  '/themes/(.*\.(css|js|jpg|gif|png))', handlers.ReadThemeFile, 

  '', handlers.DerectToMain,
  '/main', handlers.ViewMainPage,
  
  '/memcache/flush',handlers.FlushMemcache,
  
  '/blog',handlers.DerectToUpdate,
  '/blog/update',handlers.ViewBlogUpdatePage,
  '/blog/update/submit',handlers.UpdateBlog,

  '/logout',handlers.Logout,
  '/login',handlers.ViewLoginPage,
  '/login/submit',handlers.Login,

  '/admin',handlers.DerectToUpdate,
  '/admin/update',handlers.ViewAdminUpdatePage, 
  '/admin/update/submit',handlers.UpdateAdmin,
  
  '/article',handlers.DerectToList,
  '/article/list',handlers.ViewArticleListPage,
  '/article/new',handlers.ViewArticleNewPage,
  '/article/new/submit',handlers.NewArticle,
  '/article/edit/(\d+)',handlers.ViewArticleEditPage,
  '/article/edit/(\d+)/submit',handlers.UpdateArticle,
  '/article/delete/(\d+)',handlers.DeleteArticle,
  
  '/category',handlers.DerectToList,
  '/category/list',handlers.ViewCategoryListPage,
  '/category/new',handlers.ViewCategoryNewPage,
  '/category/new/submit',handlers.NewCategory,
  '/category/edit/(\d+)',handlers.ViewCategoryEditPage,
  '/category/edit/(\d+)/submit',handlers.UpdateCategory,
  '/category/delete/(\d+)',handlers.DeleteCategory, 

  '/navigation',handlers.DerectToList,
  '/navigation/list',handlers.ViewNavigationListPage,
  '/navigation/new',handlers.ViewNavigationNewPage,
  '/navigation/new/submit',handlers.NewNavigation,
  '/navigation/edit/(\d+)',handlers.ViewNavigationEditPage,
  '/navigation/edit/(\d+)/submit',handlers.UpdateNavigation,
  '/navigation/delete/(\d+)',handlers.DeleteNavigation,


  '/image',handlers.DerectToList,
  '/image/list',handlers.ViewImageListPage,
  '/image/upload',handlers.ViewImageUploadPage,
  '/image/upload/submit',handlers.UploadImage,
  '/image/delete/(\d+)',handlers.DeleteImage,
  '/image/oauth',handlers.ViewOauthLinkPage,
  '/image/oauth/auth',handlers.OAuthorize, 
  '/image/oauth/cancle',handlers.CancleOAuth,


#  '/archive/',handlers.DerectToList,
#  '/archive/list',handlers.ViewListArchivePage,
#  '/archive/delete/(\d+)',handlers.DeleteArchive, 
  
#  '/tag/',handlers.DerectToList,
#  '/tag/list',handlers.ViewListTagPage,
#  '/tag/delete/(\d+)',handlers.DeleteTag, 

)

app_admin = web.application(urls,locals())
